﻿using DocumentFormat.OpenXml.Lite.DrawingML.Types;
using DocumentFormat.OpenXml.Lite.Xml;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Schema;
using System.Xml.Serialization;

namespace DocumentFormat.OpenXml.Lite.DrawingML.Color
{
    [XmlRoot("", Namespace = Constants.Main)]
    public class Color : XmlSerializable
    {
        [XmlElement("", Namespace = Constants.Main)]
        public IColorElement ColorElement { get; set; }

        public Color() { }
    }

    [XmlRoot("scrgbClr", Namespace = Constants.Main)]
    public class RbgColorPercentageVariant : ColorModel, IColorElement
    {
        [XmlAttribute("r", Form = XmlSchemaForm.Qualified)]
        public int Red { get; set; }

        [XmlAttribute("g", Form = XmlSchemaForm.Qualified)]
        public int Green { get; set; }

        [XmlAttribute("b", Form = XmlSchemaForm.Qualified)]
        public int Blue { get; set; }

        public RbgColorPercentageVariant() { }
    }

    [XmlRoot("srgbClr", Namespace = Constants.Main)]
    public class RbgColorHexVariant : ColorModel, IColorElement
    {
        [XmlAttribute("val", Form = XmlSchemaForm.Qualified)]
        public string Value { get; set; }

        public RbgColorHexVariant() { }
    }

    [XmlRoot("hslClr", Namespace = Constants.Main)]
    public class HslColorModel : ColorModel, IColorElement
    {
        [XmlAttribute("hue", Form = XmlSchemaForm.Qualified)]
        public int Hue { get; set; }

        [XmlAttribute("sat", Form = XmlSchemaForm.Qualified)]
        public int Saturation { get; set; }

        [XmlAttribute("lum", Form = XmlSchemaForm.Qualified)]
        public int Luminance { get; set; }

        public HslColorModel() { }
    }

    [XmlRoot("sysClr", Namespace = Constants.Main)]
    public class SystemColorModel : ColorModel, IColorElement
    {
        [XmlAttribute("val", Form = XmlSchemaForm.Qualified)]
        public ST_SystemColorVal ColorValue { get; set; }

        [Optional]
        [XmlAttribute("lastClr", Form = XmlSchemaForm.Qualified)]
        public string LastColor { get; set; }

        public SystemColorModel() { }
    }

    [XmlRoot("schemeClr", Namespace = Constants.Main)]
    public class SchemeColorModel : ColorModel, IColorElement
    {
        [XmlAttribute("val", Form = XmlSchemaForm.Qualified)]
        public ST_SchemeColorVal ColorValue { get; set; }

        public SchemeColorModel() { }
    }

    [XmlRoot("prstClr", Namespace = Constants.Main)]
    public class PresetColor : ColorModel, IColorElement
    {
        [Optional]
        [XmlAttribute("val", Form = XmlSchemaForm.Qualified)]
        public ST_PresetColorVal ColorValue { get; set; }

        public PresetColor() { }
    }
}
